package com.imooc.springmvc2.conditional;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * Created by joe on 16-8-11.
 *
 * 通过@Conditional注解,符合windows条件则实例化windowsListService;符合Linux,则实例化LinuxListService
 */
@Configuration
public class ConditiConfig {
    @Bean
    @Conditional(WindowsCondition.class)
    public ListService windowsListService(){
        return new WindowsListService();
    }

    @Bean
    @Conditional(LinuxCondition.class)
    public ListService linuxListService(){
        return new LinuxListService();
    }
}
